home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 44
/
Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso
/
Aminet
/
dev
/
moni
/
systemviewer.lha
/
SysCommon.c
< prev
next >
Wrap
C/C++ Source or Header
|
2001-02-16
|
3KB
|
154 lines
/****h* AmigaTalk/SysCommon.c *************************************
*
* NAME
* SysCommon.c
*
* HISTORY
* 05/02/99 - Deleted code & variables associated with
* RenderHook(), since it's no longer necessary
* for the latest version of the OS to highlight
* the selected ListView item.
*
* FUNCTIONAL INTERFACE:
*
* PUBLIC int SetupSystemList( (*OpenWindowFunc)( void ) );
*
* PUBLIC void ShutdownSystemList( void );
*
*******************************************************************
*
*/
#include <string.h>
#include <exec/types.h>
#include <exec/lists.h>
#include <exec/nodes.h>
#include <AmigaDOSErrs.h>
#include <intuition/intuition.h>
#include <intuition/classes.h>
#include <intuition/classusr.h>
#include <intuition/gadgetclass.h>
#include <libraries/gadtools.h>
#include <graphics/displayinfo.h>
#include <graphics/gfxbase.h>
#include <graphics/gfxmacros.h> // for SetAfPt() macro.
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/graphics_protos.h>
#include <clib/diskfont_protos.h>
#include <pragmas/exec_pragmas.h>
#include <pragmas/intuition_pragmas.h>
#include <pragmas/gadtools_pragmas.h>
#include <pragmas/graphics_pragmas.h>
#include "CPGM:GlobalObjects/CommonFuncs.h"
#define ALLOCATE_VARS 1
# include "SysLists.h"
#undef ALLOCATE_VARS
PRIVATE struct Library *UtilityBase;
PRIVATE struct DrawInfo *drawInfo = NULL;
PRIVATE int SetupScreen( void )
{
Font = &Attr;
if ((Scr = LockPubScreen( PubScreenName )) == NULL)
return( -1 );
/* this statement was NOT generated by GadToolsBox: */
if ((drawInfo = GetScreenDrawInfo( Scr )) == NULL)
{
UnlockPubScreen( NULL, Scr );
return( -2 );
}
ComputeFont( Scr, Font, &CFont, 0, 0 );
if ((VisualInfo = GetVisualInfo( Scr, TAG_DONE )) == NULL)
{
/* this statement was NOT generated by GadToolsBox: */
FreeScreenDrawInfo( Scr, drawInfo );
UnlockPubScreen( NULL, Scr );
return( -3 );
}
return( 0L );
}
PRIVATE void CloseDownScreen( void )
{
if (VisualInfo != NULL)
{
FreeVisualInfo( VisualInfo );
VisualInfo = NULL;
}
/* this statement was NOT generated by GadToolsBox: */
if (drawInfo != NULL)
{
FreeScreenDrawInfo( Scr, drawInfo );
drawInfo = NULL;
}
if (Scr != NULL)
{
UnlockPubScreen( NULL, Scr );
Scr = NULL;
}
return;
}
PUBLIC int SetupSystemList( int (*OpenWindowFunc)( void ) )
{
if (OpenLibs() < 0)
return( -1 );
if ((UtilityBase = OpenLibrary( "utility.library", 39 )) == NULL)
{
CloseLibs();
return( -2 );
}
if (SetupScreen() < 0)
{
CloseLibs();
CloseLibrary( (struct Library *) UtilityBase );
return( -3 );
}
if (OpenWindowFunc() < 0)
{
CloseDownScreen();
CloseLibrary( (struct Library *) UtilityBase );
CloseLibs();
return( -4 );
}
return( 0 );
}
PUBLIC void ShutdownSystemList( void )
{
// Window has to be closed by the HandleIDCMP() function.
CloseDownScreen();
CloseLibrary( (struct Library *) UtilityBase );
CloseLibs();
return;
}
/* -------------------- END of SysCommon.c file! ----------------- */